<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
    <title>Spring 3 hibernate integration example on www.howtodoinjava.com</title>
</head>
<body>

<h2>Employee Management Screen : Spring 3 hibernate integration example on www.howtodoinjava.com</h2>

<form:form method="post" action="add" commandName="employee">

    <table>
        <tr>
            <td><form:label path="firstname">fisrtname</form:label></td>
            <td><form:input path="firstname" /></td>
        </tr>
        <tr>
            <td><form:label path="lastname">lastname</form:label></td>
            <td><form:input path="lastname" /></td>
        </tr>
        <tr>
            <td><form:label path="email">email</form:label></td>
            <td><form:input path="email" /></td>
        </tr>
        <tr>
            <td><form:label path="telephone">telphone</form:label></td>
            <td><form:input path="telephone" /></td>
        </tr>
        <tr>
            <td colspan="2">
                <input type="submit" value="add"/>
            </td>
        </tr>
    </table>
</form:form>


<h3>Employees</h3>
<c:if  test="${!empty employeeList}">
    <table class="data">
        <tr>
            <th>Name</th>
            <th>Email</th>
            <th>Telephone</th>
            <th>&nbsp;</th>
        </tr>
        <c:forEach items="${employeeList}" var="emp">
            <tr>
                <td>${emp.lastname}, ${emp.firstname} </td>
                <td>${emp.email}</td>
                <td>${emp.telephone}</td>
                <td><a href="delete/${emp.id}">delete</a></td>
            </tr>
        </c:forEach>
    </table>
</c:if>

</body>
</html>